<?php
/*
 * Cms所有分类管理
 */
class Libs_Cms_Class {

    protected static $_dbAdmin;

    /**
     * 数据库链接
     */
    public static function loadDb() {
        self::$_dbAdmin = Db_Admin::instance();
    }

    /*
     * 获得所有频道
     */
    public static function getClassArr($paramArr){
       if (is_array($paramArr)) {
			$options = array(
				'appId' => 0,
				'num' =>0,
			);
			$options = array_merge($options, $paramArr);
			extract($options);
		}
        self::loadDb();
        $appId = (int)$appId;
        $num = (int)$num;
        if(!$appId)return false;

        $param = array(
                'db'          => self::$_dbAdmin,
                'fromSql'     => " from cms_class ",
                'orderBySql'  => " order by id desc ",
                'whereSql'    => " where appId = {$appId} and status = 0 ",
                'pagesize'    => $num ? $num : 1000,
                'page'        => 1,
                'onlyData'    => true,
        );
        $listData = Libs_DBHelper::getList($param);
        return $listData;

    }


    /*
     * 获得所有子类
     */
    public static function getSubClassArr($paramArr){
       if (is_array($paramArr)) {
			$options = array(
				'classId' => 0,
				'num' =>0,
			);
			$options = array_merge($options, $paramArr);
			extract($options);
		}
        self::loadDb();
        $classId = (int)$classId;
        $num = (int)$num;
        if(!$classId)return false;

        $param = array(
                'db'          => self::$_dbAdmin,
                'fromSql'     => " from cms_subclass ",
                'orderBySql'  => " order by id desc ",
                'whereSql'    => " where classId = {$classId} and status = 0 ",
                'pagesize'    => $num ? $num : 1000,
                'page'        => 1,
                'onlyData'    => true,
        );
        $listData = Libs_DBHelper::getList($param);
        return $listData;

    }


}

?>
